﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudReader.IO.Update
{
    [Serializable]
    public struct FileRegistry
    {
        readonly string _md5;
        public FileRegistry(string file)
        {
            if(System.IO.File.Exists(file))
            {
                var data = System.IO.File.ReadAllBytes(file);
                var md5 = new System.Security.Cryptography.MD5Cng();
                _md5 = Convert.ToBase64String(md5.ComputeHash(data));
                File = file;
            }
            else
            {
                _md5 = File = string.Empty;
            }
        }
        public string File { get; set; }
        public string MD5 => _md5;
    }
}
